import React from 'react';
import Helmet from 'react-helmet'
import { HeaderNav, Footer } from 'components';
import Desc from './components/desc';
import http from 'libs/http'
import './index.less';

class Home extends React.Component {
  state = {
    authority: ''
  }
  
  componentDidMount() {
    this.checkRoleType()
  }

  checkRoleType = () => {
    http.get('/role/getRole').then(res => {
      res.data && this.setState({
        authority: res.data
      })
    })
  }

  render() {
    const { authority } = this.state
    const { history } = this.props
    return (
      <div className="home">
        <Helmet title="子塾"/>
        <HeaderNav history={history} />
        <Desc {...this.props} authority={authority} />
        <Footer/>
      </div>
    )
  }
}

export default Home
